﻿// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. 
// See License.txt in the project root for license information.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace System.Cloud.Collections
{
    // Should ICollectionAsync<T> extend ICollection<T>?
    // Good for interoperability, but allows users to write blocking code.
    // Krzysztof's opinion is this interface shouldn't extend ICollection<T> because
    // it would allow users to write blocking code, and it would let them ignore the
    // fact that they now have a remote object that can fail in the middle of 
    // operations surprisingly.
    public interface ICollectionAsync<T> // : IObservable<T>?
    {
        Task<int> CountAsync { get; }
        Task<bool> IsReadOnlyAsync { get; }
        TimeSpan Timeout { get; set; }

        Task AddAsync(T item);
        Task ClearAsync();
        Task<bool> ContainsAsync(T item);
        Task CopyToAsync(T[] array, int arrayIndex);
        Task<bool> RemoveAsync(T item);
    }
}
